<template>
  <div>
  <el-dialog
        class='width-dealog'
        title="添加生命体征"
        :visible.sync="isSigns"
        append-to-body
        :before-close="VitalClose">
            <div class="Signs">
                  <div class="demo-input-suffix">

                    收缩压(mmHg):
                    <el-input type="age" v-model.number="shrink"   >
                    </el-input>
                     脉搏(次/分):
                    <el-input type="age" v-model.number="pulse"   >
                    </el-input>
                  </div>
                  <div class="demo-input-suffix">
                    舒张压(mmHg):
                    <el-input type="age" v-model.number="diastole"   >
                    </el-input>
                     呼吸(次/分):
                    <el-input type="age" v-model.number="breathing"   >
                    </el-input>
                  </div>
                 
                  <div class="demo-input-suffix">
                    体温(℃):
                    <el-input type="age" v-model.number="temperature"   >
                    </el-input>
                    阶段：
                    <template>
                    <el-select v-model="ostage" placeholder="请选择">
                      <el-option
                        v-for="item in stageArr"
                        :key="item.cycles"
                        :label="item.cycles"
                        :value="item.cycles">
                      </el-option>
                    </el-select>
                  </template>
                  </div>
                  <div class="demo-input-suffix demo-input-suffixs">
                    
                    <template>
                          <span class="demonstration">测量时间:</span>
                            <el-date-picker
                              v-model="sign_time"
                              type="datetime"
                              @change="getTime3"
                              placeholder="选择日期时间"
                              >
                            </el-date-picker>
                          </template>
                
                  </div>                 
                 
            
          
                <el-button type="primary" class="addBing addBingRight" @click='addVital()'>添加生命体征</el-button>
          </div>
      </el-dialog>
      <el-dialog
        class='oResults-width'
        title="添加检验结果"
        :visible.sync="oResults"
        append-to-body
        :before-close="oResultsClose">
            <div class="Signsoo">
                 <div class="demo-input-suffix">
                  <span class='spanW'>检验项目：</span>
                  <el-input type="age" v-model="examine_pro"></el-input>
                  <span class="spanW">
                    检验类别：
                  </span>
                   
                  <template>
                      <el-select v-model="examine_type" placeholder="请选择">
                        <el-option
                          v-for="item in oExamine"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name">
                        </el-option>
                      </el-select>
                    </template>
                  
                  
              </div>
            <div class="demo-input-suffix">
  <span class="spanW">
                    检验值：
                  </span>
              
                <el-input type="age" v-model="examine_val"></el-input>
                <span class="spanW">
                    单位：
                  </span>
                
                    <el-input type="age" v-model.number="examine_unit"   >
                    </el-input>
                    
            </div>
             <div class="demo-input-suffix">
             <span class="spanW">
                    检验范围：
                  </span>
                
                <el-input type="age" v-model="examine_range"></el-input>
              
                
                <span class="spanW">
                    阶段：
                  </span>
                    <template>
                    <el-select v-model="examine_stage" placeholder="请选择">
                      <el-option
                        v-for="item in stageArr"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </template>
                

            </div>
            <div class="demo-input-suffix">
                
                 <span class="spanW">
                     临床意义判定
                  </span>
                    <el-select v-model="examine_judge" placeholder="请选择角色">
                        <el-option
                          v-for="item in determine"
                          :label="item.name"
                          :value="item.name"

                          >
                        </el-option>
                      </el-select>
                      <template>
                <span class="demonstration spanW">检验时间：</span>
                  <el-date-picker
                    v-model="examine_time"
                    type="datetime"
                    @change="getTime4"
                    placeholder="选择日期时间"
                    >
                  </el-date-picker>
                </template>
            </div>
            <div class="demo-input-suffix" v-if="examine_judge==3">
                       <el-input
                          type="textarea"
                          placeholder="异常数据解释"
                          v-model="examine_explain">
                        </el-input>
                  </div>
             <div class="demo-input-suffix colssro">
                      注：临床意义判定：1、正常；2、异常无临床意义；3、异常有临床意义；（请填写“异常数据解释”）4、未查如果临床意义判定选择；

                  </div>
                 
                  
                 
                 
            
          
                <el-button type="primary" class="addBing addBingRight" @click='addTTest()'>添加检验结果</el-button>
          </div>
      </el-dialog>
      <el-dialog
        width="50%"
        title="添加不良事件"
        :visible.sync="isEsults"
        append-to-body
        class="isEsults-dialog"
        :before-close="esultsClose">
            <div class="Signss">
                  <div class="demo-input-suffix">
                  <span class="isEsultsSw">
                    不良事件编号：
                  </span>
                   
                    <el-input type="age" v-model="esults_num"   >
                    </el-input>
                    <span class="isEsultsSw">
                    不良事件名称：
                  </span>
                    
                    <el-input type="age" v-model="esults_title"   >
                    </el-input>
                  </div>
                  <div class="demo-input-suffix">
                    
                    <template>
                          <span class="demonstration isEsultsSw">开始日期:</span>
                            <el-date-picker
                              v-model="esults_start_time"
                              type="datetime"
                              @change="getTime"
                              placeholder="选择日期时间"
                              >
                            </el-date-picker>
                          </template>
                      <template>
                    <span class="demonstration isEsultsSw">结束日期:</span>
                            <el-date-picker
                              v-model="esults_end_time"
                              type="datetime"
                              @change="getTime1"
                              placeholder="选择日期时间"
                              >
                            </el-date-picker>
                          </template>
                  </div>
                  <div class="demo-input-suffix sss">
                  <span class="isEsultsSw">
                    严重程度:
                  </span>
                   
                    <el-select v-model="esults_serious" placeholder="请选择角色" >
                        <el-option
                          v-for="item in Severity"
                          :label="item.name"
                          :value="item.id"

                          >
                        </el-option>
                      </el-select>
                      <span class="isEsultsSw">
                    结局:
                  </span>
                     
                    <el-select v-model="esults_ending" placeholder="请选择角色" >
                        <el-option
                          v-for="item in Ending"
                          :label="item.name"
                          :value="item.id"

                          >
                        </el-option>
                      </el-select>
                   
                  </div>
                  
                  <div class="demo-input-suffix">

                    对研究用药采取的措施
                     <el-select v-model="esults_measure" placeholder="请选择角色" >
                        <el-option
                          v-for="item in Measures"
                          :label="item.name"
                          :value="item.id"

                          >
                        </el-option>
                      </el-select>
                  </div>
                  <div class="demo-input-suffix">
                    
                     <el-input
                      type="textarea"
                      placeholder="对研究用药采取的其他措施"
                      v-model="esults_measure_bz">
                    </el-input>
                  </div>
                  <div class="demo-input-suffix">
                    与研究药物的关系
                     <el-select v-model="esults_nexus" placeholder="请选择角色" >
                        <el-option
                          v-for="item in Relaship"
                          :label="item.name"
                          :value="item.id"

                          >
                        </el-option>
                      </el-select>
                      
                  </div>
                  <div class="demo-input-suffix">
                    是否为严重不良事件：
                    <template>
                      <el-radio-group v-model="esults_serious_ae">
                        <el-radio :label="1">是</el-radio>
                        <el-radio :label="2">否</el-radio>
                      </el-radio-group>
                    </template>
                    
                      
                  </div>
                  <div class="demo-input-suffix">
                  
                    是否导致死亡：
                    <template>
                      <el-radio-group v-model="esults_death">
                        <el-radio :label="1">是</el-radio>
                        <el-radio :label="2">否</el-radio>
                      </el-radio-group>
                    </template>
                    <template v-if='esults_death==1'>
                          <span class="demonstration">死亡日期:</span>
                          <el-date-picker
                            v-model="esults_death_time"
                            type="datetime"
                            @change="getTime2"
                            placeholder="选择日期时间"
                            >
                          </el-date-picker>
                        </template>
                  </div>
                  
                 <div class="demo-input-suffix">
                    
                     <el-input
                      type="textarea"
                      placeholder="不良事件详情说明"
                      v-model="esults_explain">
                    </el-input>
                  </div>
                  <div class="demo-input-suffix">
                    
                     <el-input
                      type="textarea"
                      placeholder="如为SAE，请说明SAE发生及处理的详细情况"
                      v-model="esults_sae">
                    </el-input>
                  </div>
                 
            
          
                <el-button type="primary" class="addBing addBingRight" @click='addEsults()'>添加不良事件</el-button>
          </div>
      </el-dialog>
    <el-dialog title="受试者档案" :visible.sync="dialogVisible" :before-close="closeDialog" v-on:open="loadData" :close-on-click-modal="false" >
      <el-tabs v-model="activeName" @tab-click="tabClick">
        <el-tab-pane label="基础信息" name="first">
          <el-form :model="form" :inline="true" :rules="rules" ref="form" labelWidth="100px">
            <el-row>
              <el-col>
                <el-form-item label="姓名" labelWidth="140px">
                  {{form.name}}
                </el-form-item>
                <el-form-item label="性别" labelWidth="40px">
                  {{form.sex}}
                </el-form-item>
                <el-form-item label="身份证号" labelWidth="80px">
                  {{form.cardid}}
                </el-form-item>
                <el-form-item label="年龄" labelWidth="40px">
                  {{form.age}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="筛选号">
                  <el-input v-model="form.candidateNum" :readonly="true"></el-input>
                </el-form-item>
                <el-form-item label="随机号" property="randomNum">
                  <el-input v-model="form.randomNum" placeholder="此处填写随机号"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="招募日期" >
                  <el-date-picker
                    v-model="form.recruitDate"
                    type="date"
                    :readonly="true"
                    placeholder="选择日期"
                    :picker-options="pickerOptions0">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="联系电话" prop="mobile" >
                  <el-input v-model="form.mobile"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="联系地址" prop="address" >
                  <el-input v-model="form.address"></el-input>
                </el-form-item>
                <el-form-item label="紧急联系人" prop="urgentContact" >
                  <el-input v-model="form.urgentContact"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="紧急联系电话" prop="urgentMobile" >
                  <el-input v-model="form.urgentMobile"></el-input>
                </el-form-item>
                <!-- <el-form-item label="服药类别" prop="urgentMobile" >
                  <el-input v-model="form.medicine"></el-input>
                </el-form-item> -->

              </el-col>
            </el-row>
            <el-row>
              <el-col>
               <el-form-item label="最后随访日期">
                  {{form.lastFlupDate}}
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="参与项目" name="third">
          <el-form :model="form" :inline="true" :rules="rules" ref="form" labelWidth="100px">
            <el-row>
              <el-col :span="24">
                <el-form-item style="width: 100%">项目名称：{{form.projectName}}</el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="筛选号">{{form.candidateNum}}</el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="招募日期" >{{form.recruitDate}}</el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="筛选结果" >{{form.candidateResult == 1?'失败':'成功'}}</el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="通过筛选时间">{{form.passTime}}</el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="住院状态">
                  {{hosList[form.hospitalStatus].label}}
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="试验状态" property="status">
                  <el-select  v-model="form.testStatus" placeholder="请选择">
                    <el-option
                      v-for="item in testList"
                      :key="form.testStatus"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <!--<el-form-item label="受试者号" property="subjectsNum"  >{{form.num}}</el-form-item>-->
            <el-form-item label="依从性评分">
              <el-rate
                v-model="complianceScore" show-text text-template="{value}" :texts="['1分','2分','3分','4分','5分']"
                :colors="['#99A9BF', '#F7BA2A', '#FF9900']">
              </el-rate>
            </el-form-item>
            <el-form-item label="试验人员评价">
              <el-input type="textarea" style="width:400px;" v-model="form.evaluate"></el-input>
            </el-form-item>
      </el-form>
        </el-tab-pane>
        <el-tab-pane label="查看筛选期数据" name="period">
          <el-collapse v-model="fengone" accordion>
                <el-collapse-item title="人口学资料" name="1">
                  <div>
                     <span>
                        身高：{{form.height}}cm
                      </span>
                       <span>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;体重：{{form.weight}}kg
                      </span>
                       <span>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BMI指数：{{form.bmi}}
                      </span>

                  </div>
                        
                </el-collapse-item>
              <el-collapse-item title="吸烟史" name="2">
                 <template>
                      <el-table
                        :data="smokeArr"
                        border
                        
                        style="width: 100%">
                        <el-table-column
                        type="index"
                        label="序号"
                        width="80">
                      </el-table-column>
                        <el-table-column
                          prop="smoke_num"
                          label="吸烟数量"
                          width="180">
                        </el-table-column>
                       
                        <el-table-column
                          prop="start_time"
                          label="开始时间"
                          width="180">
                        </el-table-column>
                         <el-table-column
                          label="是否继续">
                          <template  slot-scope="scope">
             
                              {{smokeZI[scope.row.status]}}
                        </template>
                        </el-table-column>
                        <el-table-column
                          prop="end_time"
                          label="结束时间">
                        </el-table-column>
                        <!-- <el-table-column
                          fixed="right"
                          label="操作">
                          <template  slot-scope="scope">
             
                              <el-button type="text" @click.native="all_del(scope.row)">删除</el-button>
                        </template>
                        </el-table-column> -->
                      </el-table>
                    </template>
              </el-collapse-item>
              <el-collapse-item title="过敏史" name="3">
                <template>
                      <el-table
                        :data="allergyArr"
                        border
                        style="width: 100%">
                        <el-table-column
                        type="index"
                        label="序号"
                        width="80">
                      </el-table-column>
                        <el-table-column
                          prop="allergy"
                          label="过敏史详情">
                        </el-table-column>
                       
                        <!-- <el-table-column
                          fixed="right"
                          label="操作">
                          <template  slot-scope="scope">
             
                                <el-button type="text" @click.native="all_del(scope.row)">删除</el-button>
                          </template>
                        </el-table-column> -->
                      </el-table>
                    </template>
              </el-collapse-item>
              <el-collapse-item title="手术史" name="4">
                <template>
                    <el-table
                      :data="surgeryArr"
                      border
                      style="width: 100%">
                      <el-table-column
                        type="index"
                        label="序号"
                        width="80">
                      </el-table-column>
                      <el-table-column
                        prop="surgery_name"
                        label="手术名称"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        prop="time"
                        label="手术日期">
                      </el-table-column>
                    
                      <el-table-column
                        prop="bz"
                        label="备注">
                      </el-table-column>
                      <!-- <el-table-column
                        fixed="right"
                        label="操作">
                        <template  slot-scope="scope">
           
                            <el-button type="text" @click.native="all_del(scope.row)">删除</el-button>
                      </template>
                      </el-table-column> -->
                    </el-table>
                  </template>
              </el-collapse-item>
              <el-collapse-item title="病史" name="5">
                <template>
                    <el-table
                      :data="sickArr"
                      border
                      style="width: 100%">
                      <el-table-column
                        type="index"
                        label="序号"
                        width="80">
                      </el-table-column>
                      <el-table-column
                        prop="sick_name"
                        label="疾病名称"
                        width="180">
                      </el-table-column>
                      
                      <el-table-column
                        prop="start_time"
                        label="开始时间"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        label="目前是否持续">
                        <template  slot-scope="scope">

                              {{continued[scope.row.status]}}
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="end_time"
                        label="结束时间">
                      </el-table-column>
                      <!-- <el-table-column
                        fixed="right"
                        label="操作">
                        <template  slot-scope="scope">
           
                            <el-button type="text" @click.native="all_del(scope.row)">删除</el-button>
                      </template>
                      </el-table-column> -->
                    </el-table>
                  </template>
              </el-collapse-item>
              <el-collapse-item title="既往用药史" name="6">
                <template>
                    <el-table
                      :data="pharmacyArr"
                      border
                      style="width: 100%">
                      <el-table-column
                        type="index"
                        label="序号"
                        width="80">
                      </el-table-column>
                      <el-table-column
                        prop="pharmacy_name"
                        label="药物名称"
                        >
                      </el-table-column>
                      <el-table-column
                        prop="dosage"
                        label="剂量">
                      </el-table-column>
                      <el-table-column
                        prop="unit"
                        label="单位"
                        >
                      </el-table-column>
                      <el-table-column
                        prop="rate"
                        label="频率">
                      </el-table-column>
                      <el-table-column
                        prop="way"
                        label="给药途径">
                      </el-table-column>
                      <el-table-column
                        prop="start_time"
                        label="开始时间"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        label="是否持续">
                        <template  slot-scope="scope">

                              {{continued[scope.row.status]}}
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="end_time"
                        label="结束时间"
                        width="180">
                      </el-table-column>
                      <!-- <el-table-column
                        fixed="right"
                        label="操作">
                        <template  slot-scope="scope">
           
                            <el-button type="text" @click.native="all_del(scope.row)">删除</el-button>
                      </template>
                      </el-table-column> -->
                    </el-table>
                  </template>
              </el-collapse-item>
            </el-collapse>
        </el-tab-pane>
         <el-tab-pane label="生命体征" name="lsigns">
          <el-button type="primary" class="addBing" @click="vitals()">添加生命体征</el-button>
                  <template>
                    <el-table
                      :data="vitalsign"
                      border
                      height='300'
                      style="width: 100%">
                      <el-table-column
                        label="阶段"
                        width="120">
                        <template  slot-scope="scope">
           
                            {{mentstage[scope.row.stage]}}
                      </template>
                        
                      </el-table-column>
                      <el-table-column
                        prop="systolic"
                        label="收缩压(mmHg)"
                        width="150">
                      </el-table-column>
                      <el-table-column
                        prop="diastolic"
                        label="舒张压(mmHg)"
                        width="150">
                      </el-table-column>
                      <el-table-column
                        prop="pulse"
                        label="脉搏(次/分)"
                        width="120">
                      </el-table-column>
                       <el-table-column
                        prop="breath"
                        label="呼吸(次/分)"
                         width="120"
                         >
                      </el-table-column>
                      <el-table-column
                        prop="temperature"
                        label="体温(℃)"
                         width="100">
                      </el-table-column>
                      <el-table-column
                        prop="time"
                        label="测量时间"
                         width="200">
                      </el-table-column>
                      <el-table-column
                        fixed="right"
                        label="操作"
                        >
                        <template  slot-scope="scope" v-if="scope.row.stage==2">
           
                            <el-button type="text" @click.native="all_del(scope.row)">删除</el-button>
                      </template>
                      </el-table-column>
                    </el-table>
                  </template>
        </el-tab-pane>
        <el-tab-pane label="检验结果" name="results">
          <el-button type="primary" class="addBing" @click='addtest()'>添加检验结果</el-button>
                  <template>
                    <el-table
                      :data="testArr"
                      border
                      height='300'
                      style="width: 100%">
                      <el-table-column
                        type="index"
                        label="序号"
                        width="80">
                      </el-table-column>
                      <el-table-column
                        label="阶段"
                        width="120">
                        <template  slot-scope="scope">
           
                            {{mentstage[scope.row.stage]}}
                      </template>
                        
                      </el-table-column>
                      <el-table-column
                        prop="pro"
                        label="检验项目"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        prop="type"
                        label="类别"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        prop="val"
                        label="检验值">
                      </el-table-column>
                      <el-table-column
                        prop="range"
                        label="参考范围"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        prop="unit"
                        label="单位"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        prop="judge"
                        label="临床意义判定"
                        width="180">
                      </el-table-column>
                      
                      <el-table-column
                        prop="time"
                        label="检验时间"
                        width="200">
                      </el-table-column>
                      <el-table-column
                        prop="explain"
                        label="异常数据解释"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        fixed="right"
                        label="操作">
                        <template  slot-scope="scope" >
           
                            <el-button type="text" @click.native="all_del(scope.row)" v-if='scope.row.stage==2'>删除</el-button>
                      </template>
                      </el-table-column>
                    </el-table>
                  </template>
        </el-tab-pane>
        <el-tab-pane label="不良事件" name="event">
         <el-button type="primary" class="addBing" @click='addverse()'>添加不良事件</el-button>
                  <template>
                    <el-table
                      :data="aeArr"
                      border
                      height='300'
                      style="width: 100%">
                       <el-table-column
                        prop="num"
                        label="编号">
                      </el-table-column>
                      <el-table-column
                        prop="title"
                        label="检验项目"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        prop="start_time"
                        label="开始时间"
                        width="180">
                      </el-table-column>
                       <el-table-column
                        prop="end_time"
                        label="结束时间"
                        width="180">
                      </el-table-column>
                       <el-table-column
                        label="严重程度"
                        width="180">
                        <template  slot-scope="scope">
                            {{SeverityObj[scope.row.serious]}}
                        </template>
                        
                      </el-table-column>
                       <el-table-column
                        label="结局"
                        width="180">
                         <template  slot-scope="scope">
                            {{EndingObj[scope.row.ending]}}
                        </template>
                      </el-table-column>
                       <el-table-column
                        label="措施"
                        width="180">
                        <template  slot-scope="scope">
                            {{MeasuresObj[scope.row.measure]}}
                        </template>
                      </el-table-column>
                       <el-table-column
                        prop="measure_bz"
                        label="其他措施"
                        width="180">
                      </el-table-column>
                       <el-table-column
                        label="与药物关系"
                        width="180">
                        <template  slot-scope="scope">
                            {{RelashipObj[scope.row.nexus]}}
                        </template>
                        
                      </el-table-column>
                      <el-table-column
                        label="是否为严重不良事件"
                        width="180">
                        <template  slot-scope="scope">
                            {{continued[scope.row.serious_ae]}}
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="death"
                        label="是否死亡"
                        width="100">
                      </el-table-column>
                      <el-table-column
                        prop="death_time"
                        label="死亡时间"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        prop="explain"
                        label="解释说明"
                        width="180">
                      </el-table-column>
                      <el-table-column
                        prop="sae"
                        label="sae说明"
                        width="180">
                      </el-table-column>
                     

                      <el-table-column
                        fixed="right"
                        label="操作">
                        <template  slot-scope="scope">
           
                            <el-button type="text" @click.native="all_del(scope.row)">删除</el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                  </template>
        </el-tab-pane>
      </el-tabs>
      <el-row>
        <el-col :span="24" style="padding:10px;">
          <!-- <span style="color:red;float:left;">"*"为必填项。</span> -->
          <div class="pull-right">
            <el-button v-if="$utils.ckUIPower('S01010101')" type="primary" @click.native.prevent="handleSubmit" :disabled="editClick">保存
            </el-button>
            <el-button v-if="$utils.ckUIPower('S01010101')" @click.native.prevent="handleReset">重置</el-button>
            <el-button @click.native.prevent="closeDialog">取消</el-button>
          </div>
        </el-col>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
  import http from '../../../api/http'
  var model = {hospitalStatus:0,status:0,lastFlupDate:''};
  export default {
    value:'',
    data () {
      return {
        //检验参
        examine_time:'',
        examine_range:'',
        examine_val:'',
        examine_pro:'',
        examine_type:'',
        examine_unit:'',
        examine_judge:'',
        examine_explain:'',
        //生命体征参
         shrink:'',
        pulse:'',
        diastole:'',
        breathing:'',
        temperature:'',
        ostage:'',
        sign_time:'',
        //检验结果参
        aeArr:[],
        esults_start_time:'',
        esults_end_time:'',
        esults_serious:'',
        esults_ending:'',
        esults_measure:'',
        esults_measure_bz:'',
        esults_nexus:'',
        esults_serious_ae:'',
        esults_death:'',
        esults_death_time:'',
        esults_explain:'',
        esults_sae:'',
        esults_num:'',
        esults_title:'',
        examine_stage:'',

        vitalsign:[],
        oExamine:[{
          name:'血常规'
        },{
          name:'尿常规'
        }],
        mentstage:{
          1:'筛选期',
          2:'治疗期',
        },
        stageArr:[{
          id:0,
          cycles:"筛选期"
        }],
        textarea:'',
        historyGroup:[],
        allergyArr:[],
        pharmacyArr:[],
        sickArr:[],
        smokeArr:[],
        surgeryArr:[],
        fengone:1,
        editClick:false,
        lastFlupDate:'',
        picHead:'',
        hosList:[{label:'-'},{label:'入院'},{label:'出院'}],
        // 显示实验状态
        smokeZI:{
          1:"是",
          2:"否"
        },
        continued:{
          1:"是",
          2:"否"
        },
        //严重程度
        SeverityObj:{
          1:'Ⅰ级：轻度',
          2:'Ⅱ级：中度',
          3:'Ⅲ级：重度',
          4:'Ⅳ级：危机生命',
          5:'Ⅴ级：与AE相关的死亡'
        },
        //结局
        EndingObj:{
          1:'恢复',
          2:'改善',
          3:'未恢复',
          4:'恢复留有后遗症',
          5:'死亡',
          6:'未知'
        },
        //措施
        MeasuresObj:{
          1:'继续用药',
          2:'减少剂量',
          3:'药物暂停后又恢复',
          4:'停用药物',
          5:'正常停药'
        },
        Severity:[{
          id:1,
          name:'Ⅰ级：轻度'
        },{
          id:2,
          name:'Ⅱ级：中度'
        },{
          id:3,
          name:'Ⅲ级：重度'
        },{
          id:4,
          name:'Ⅳ级：危机生命'
        },{
          id:5,
          name:'Ⅴ级：与AE相关的死亡'
        }],
        Ending:[{
          id:1,
          name:'恢复'
        },{
          id:2,
          name:'改善'
        },{
          id:3,
          name:'未恢复'
        },{
          id:4,
          name:'恢复留有后遗症'
        },{
          id:5,
          name:'死亡'
        },{
          id:6,
          name:'未知'
        }],
        Measures:[{
          id:1,
          name:'继续用药'
        },{
          id:2,
          name:'减少剂量'
        },{
          id:3,
          name:'药物暂停后又恢复'
        },{
          id:4,
          name:'停用药物'
        },{
          id:5,
          name:'正常停药'
        }],
        RelashipObj:{
          1:'肯定有关',
          2:'很可能有关',
          3:'可能有关',
          4:'可能无关',
          5:'肯定无关'
        },
        Relaship:[{
          id:1,
          name:'肯定有关'
        },{
          id:2,
          name:'很可能有关'
        },{
          id:3,
          name:'可能有关'
        },{
          id:4,
          name:'可能无关'
        },{
          id:5,
          name:'肯定无关'
        }],
        determine:[{
          name:'1'
        },{
          name:'2'
        },{
          name:'3'
        },{
          name:'4'
        }],
        
        testList: [{
          value: 0,
          label: '-'
        }, {
          value: 1,
          label: '试验中 '
        }, {
          value: 2,
          label: '已完成'
        },{
          value: 3,
          label: '已退出'
        }],
        form: Object.assign({}, model),
        activeName: 'first',
        pickerOptions0: {
          disabledDate(time) {
            return time.getTime() < Date.now() - 8.64e7;
          }
        },
        rules: {},
        read: false,complianceScore:null,
        isSigns:false,
        oResults:false,//检验结果BOX
        isEsults:false,//不良事件BOX
      }
    },
    props: {
      editDialogVisible: {
        type: Boolean,
        default: false
      },
      subjectId: {type: String},
    },
    computed: {
      dialogVisible:{
          get:function () {
            return this.editDialogVisible
          },
          set:function () {
          }
      }
    },
    methods: {
      changeFingerTemplete(){
        var vm = this;
        var base64Head = 'data:image/png;base64,';
//         对比指纹
        var verify = 'verify';

        vm.form.fingerImg = "";

        http.getDataFullURL(vm, 'http://127.0.0.1:22001/zkbioonline/fingerprint/beginCapture?type=2&FakeFunOn=0', function (resp) {
          var data = resp.bodyText;
          data = JSON.parse(data);
          if (data.ret == 0) {
            vm.$message.success({title: '操作成功', message: "请按压手指"});
            setTimeout(function () {
              http.getDataFullURL(vm, 'http://127.0.0.1:22001/zkbioonline/fingerprint/getImage', function (resp) {
                var data = resp.bodyText;
                data = JSON.parse(data);
                if (data.ret == 0) {
                    // 去除 base64头信息
                  vm.form.fingerImg = data.data.jpg_base64;
                }
              })
            }, 1000);

            setTimeout(function () {
              http.getDataFullURL(vm, 'http://127.0.0.1:22001/zkbioonline/fingerprint/getTemplate', function (resp) {
                var data = resp.bodyText;
                data = JSON.parse(data);
                if (data.ret == 0) {
                  vm.form.fingerprint = data.data.template;
                }
              })
            }, 1200);
//          录入成功提示
            setTimeout(function () {
              if (vm.form.template != '' && vm.form.fingerImg != '') {
                vm.$message.success({title: '操作成功', message: "指纹信息更新成功"});
                vm.picHead ='data:image/png;base64,'+ vm.form.fingerImg;
              } else {
                vm.$message.error({title: '操作失败', message: "请重新录入"})
              }
            }, 1500);

          } else if (data.ret != 0) {
            vm.$message.error({title: '操作失败', message: "获取信息失败，请重试"});
//            console.log('仪器错误码为:' + data.ret);
//            console.log('请核对错误码检验错误!!!');
          }
          /**
           * 读取指纹信息结束
           */
        }, function (err) {
        });
      },
      getTime(date){
        this.esults_start_time=date;
      },
      getTime1(date){
        this.esults_end_time=date;
      },
      getTime2(date){
        this.esults_death_time=date;
      },
       getTime3(date){
        this.sign_time=date;
      },
      getTime4(date){
        this.examine_time=date;
      },
      tabClick(tab){
        switch (tab.name) {
          case 'first':
            break;
          case 'second':
            break;
          case 'third':
            break;
            case 'period'://查看筛选期
            break;
            case 'lsigns'://生命体征
            break;
            case 'results'://检验结果
            break;
            case 'event'://不良事件
            break;

            
        }
      },
     all_del(row){
        // console.log(this.$parent.currentSubjectId)
        var vm=this;
        http.postData(vm, "/pt/screening/myhistoryDelete", {subjectsid:vm.$parent.currentSubjectId,id:row.id,category:row.category}, function (resp) {
              var ret = resp.body;
            // console.log(resp)

              if (ret.code === '111') {
                
                vm.$notify({title: '操作提示', message: ret.msg, type: 'success'});
                vm.comeGo(row.subjects_id);
                // vm.closeDialog();
                // vm.$parent.onSubmit();
              } else {
                // vm.editClick = false;
                vm.$notify.error({title: '操作失败', message: ret.msg});
              }
            });
     },
      esultsClose(){
         var vm=this;
            vm.isEsults=false;
                vm.esults_start_time='';
                vm.esults_end_time='';
                vm.esults_serious='';
                vm.esults_ending='';
                vm.esults_measure='';
                vm.esults_measure_bz='';
                vm.esults_nexus='';
                vm.esults_serious_ae='';
                vm.esults_death='';
                vm.esults_death_time='';
                vm.esults_explain='';
                vm.esults_sae='';
                vm.esults_num='';
                vm.esults_title='';

      },
      //添加不良事件
      addEsults(){
         var vm=this;
        let category='ae';
        http.postData(vm, "/pt/screening/myhistory", {category:category,subjectsid:vm.$parent.currentSubjectId,num:vm.esults_num,start_time:vm.esults_start_time,end_time:vm.esults_end_time,serious:vm.esults_serious,ending:vm.esults_ending,measure:vm.esults_measure,measure_bz:vm.esults_measure_bz,nexus:vm.esults_nexus,serious_ae:vm.esults_serious_ae,death:vm.esults_death,death_time:vm.esults_death_time,explain:vm.esults_explain,sae:vm.esults_sae,title:vm.esults_title}, function (resp) {
              var ret = resp.body;
            // console.log(resp)

              if (ret.code === '111') {
                vm.isEsults=false;
                vm.esults_title='';
                vm.esults_start_time='';
                vm.esults_end_time='';
                vm.esults_serious='';
                vm.esults_ending='';
                vm.esults_measure='';
                vm.esults_measure_bz='';
                vm.esults_nexus='';
                vm.esults_serious_ae='';
                vm.esults_death='';
                vm.esults_death_time='';
                vm.esults_explain='';
                vm.esults_sae='';
                vm.esults_num='';
                vm.$notify({title: '操作提示', message: ret.msg, type: 'success'});
                vm.comeGo(vm.$parent.currentSubjectId);
                // vm.closeDialog();
                // vm.$parent.onSubmit();
              } else {
                // vm.editClick = false;
                vm.$notify.error({title: '操作失败', message: ret.msg});
              }
            });
      },
      //添加不良事件弹出框
      addverse(){
           var vm=this;
            vm.isEsults=true
      },
      //关闭检验结果按钮
      oResultsClose(){
        var vm=this;
         vm.oResults=false;
        vm.examine_time='';
        vm.examine_range='';
        vm.examine_val='';
        vm.examine_pro='';
        vm.examine_type='';
        vm.examine_unit='';
        vm.examine_judge='';
        vm.examine_explain='';
        vm.examine_stage='';
      },
      //添加检验结果按钮
      addTTest(){
        var vm=this;
          let category='examine';
        http.postData(vm, "/pt/screening/myhistory", {category:category,subjectsid:vm.$parent.currentSubjectId,type:vm.examine_type,pro:vm.examine_pro,val:vm.examine_val,time:vm.examine_time,range:vm.examine_range,unit:vm.examine_unit,judge:vm.examine_judge,explain:vm.examine_explain,stage:vm.examine_stage}, function (resp) {
              var ret = resp.body;
            // console.log(resp)

              if (ret.code === '111') {
                vm.oResults=false;
                vm.examine_time='';
                vm.examine_range='';
                vm.examine_val='';
                vm.examine_pro='';
                vm.examine_type='';
                vm.examine_unit='';
                vm.examine_judge='';
                vm.examine_explain='';
                vm.examine_stage='';
                vm.$notify({title: '操作提示', message: ret.msg, type: 'success'});
                vm.comeGo(vm.$parent.currentSubjectId);
                // vm.closeDialog();
                // vm.$parent.onSubmit();
              } else {
                // vm.editClick = false;
                vm.$notify.error({title: '操作失败', message: ret.msg});
              }
            });
      },
      //添加检验结果弹出框
      addtest(){
          var vm=this;
        vm.oResults=true;

      },
       // 关闭生命体征接口
      VitalClose(){
        var vm = this;
        vm.isSigns=false;
        vm.shrink='';
        vm.pulse='';
        vm.diastole='';
        vm.breathing='';
        vm.temperature='';
        vm.ostage='';
        vm.sign_time='';

      },
      // 添加生命体征接口
      addVital(){
        // console.log(this.$parent.currentSubjectId)
          var vm = this;
          let category='vitalsign';
        http.postData(vm, "/pt/screening/myhistory", {category:category,subjectsid:vm.$parent.currentSubjectId,systolic:vm.shrink,diastolic:vm.diastole,pulse:vm.pulse,breath:vm.breathing,temperature:vm.temperature,stage:vm.ostage,time:vm.sign_time}, function (resp) {
              var ret = resp.body;
            // console.log(resp)

              if (ret.code === '111') {
                vm.isSigns=false;
                vm.shrink='';
                vm.pulse='';
                vm.diastole='';
                vm.breathing='';
                vm.temperature='';
                vm.ostage='';
                vm.sign_time='';
                vm.$notify({title: '操作提示', message: ret.msg, type: 'success'});
                vm.comeGo(vm.$parent.currentSubjectId);
                // vm.closeDialog();
                // vm.$parent.onSubmit();
              } else {
                // vm.editClick = false;
                vm.$notify.error({title: '操作失败', message: ret.msg});
              }
            });
      },
      //添加生命体征弹出框
       vitals(){
        var vm=this;
        vm.isSigns=true;
        var projectId = vm.$utils.getCurrenrProject().id;
        http.postData(vm, '/pt/process/queryCycles/'+projectId,{}, function (resp) {
              console.log(resp)
              vm.clcyeArr=resp.body.value;
              var list=resp.body.value;
              for(var temp in list){
                 vm.stageArr.push(list[temp]);
              }
                // if(resp.body.code=="111"){

                // }else{
                //   alert("未录入");
                // }

          });
   
      },
      readID() {
        this.read = true;
      },
      handleReset () {
        this.form = Object.assign({}, model);
//        this.$refs.form.resetFields();
      },
      closeDialog(){
        this.editClick = false;
        this.$emit('closeEditDialog');
      },
      loadData(){
        var vm = this;
        vm.read = false;
        http.postData(vm, "/pt/subjects/detail/" + vm.$parent.currentSubjectId,{},function (resp) {
            var data = resp.body;
            if(data.code == 111){
              vm.form = data.value;
              vm.lastFlupDate=vm.form.lastFlupDate;
              if(vm.form.complianceScore!=undefined){
                vm.complianceScore=vm.form.complianceScore;
              }
              if(vm.form.evaluate==undefined){
                vm.form.evaluate='';
              }
              vm.picHead ='data:image/png;base64,' + vm.form.fingerImg;
            }
        });
      },
      handleSubmit (ev) {
        var vm = this;
        this.$refs.form.validate(function (valid) {
          if (valid) {
              vm.editClick = true;
            vm.form.lastFlupDate=vm.lastFlupDate;
            vm.form.complianceScore=vm.complianceScore;
            http.postData(vm, "/pt/subjects/save", {json: JSON.stringify(vm.form)}, function (resp) {
              var ret = resp.body;
              if (ret.code === '111') {
                vm.editClick = false;
                vm.$notify({title: '操作提示', message: ret.msg, type: 'success'});
                vm.form = Object.assign({}, model);
                vm.$emit('closeEditDialog'); // 关闭弹窗
                vm.$parent.onSubmit();
              } else {
                vm.editClick = false;
                vm.$notify.error({title: '操作失败', message: ret.msg});
              }
            });
          } else {
            return false
          }
        })
      },
      comeGo(id){
        var vm=this;
       http.postData(vm, "/pt/screening/myhistoryList", {subjectsid:vm.$parent.currentSubjectId}, function (resp) {
            var ret = resp.body;
          // console.log(resp)

            if (ret.code === '111') {
              vm.allergyArr=ret.value.allergy;
              vm.pharmacyArr=ret.value.pharmacy;
              vm.sickArr=ret.value.sick;
              vm.smokeArr=ret.value.smoke;
              vm.surgeryArr=ret.value.surgery;
              vm.form.weight=ret.value.humen.weight;
              vm.form.height=ret.value.humen.height;
              vm.form.bmi=ret.value.humen.BMI;
              vm.testArr=ret.value.examine;
              vm.vitalsign=ret.value.vitalsign;
              vm.aeArr=ret.value.ae;

              // vm.$notify({title: '操作提示', message: ret.msg, type: 'success'});
              // vm.closeDialog();
              // vm.$parent.onSubmit();
            } else {
              // vm.editClick = false;
              // vm.$notify.error({title: '操作失败', message: ret.msg});
            }
          });
      }
    }
  }
</script>
<style>
  .readID {
    width: 70%;
    height: 100px;
    border-radius: 6px;
    border: 2px solid #ccc;
    margin: auto;
    font-size: 26px;
    font-weight: bold;
    color: #cccccc;
    text-align: center;
    line-height: 100px;
    cursor: pointer;
    margin-bottom: 20px;
  }

  .title {
    width: 100px;
    border: 1px solid #ccc;
    border-radius: 4px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    color: #444444;
  }

  .wrapper {
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    margin-bottom: 10px;
  }
  .Signss .demo-input-suffix{
    margin-bottom: 20px;
  }
  /*.Signss .el-select{
    width:200px;
  }*/
  .colssro{
    color:#78c5a5;
    line-height: 24px;
    font-size: 12px;
  }
  .Signsoo .demo-input-suffix{
     margin-bottom: 20px;
  }
  .width-dealog .el-dialog--small{
    width:40%;
    margin:0 auto;
  }
  .oResults-width .el-dialog--small{
    margin:0 auto;
    width:50%;
  }
  .spanW{
    width:90px;
    display:inline-block;
  }
  .isEsultsSw{
     width:100px;
    display:inline-block;
  }
  .isEsults-dialog .el-dialog--small{
    margin:0 auto;
    width:50%;
  }

</style>
